<cfcomponent displayname="FusecacheWrapperCfMemcached" output="false" hint="Wrapper for John Hirisci's cfMemcached component.">
	
	<cfproperty name="MemcachedFactory" type="memcached.MemcachedFactory" />
	<cfproperty name="Memcached" />
	
	<!--- init() --->
	<cffunction name="init" access="public" returntype="fusecache.FusecacheWrapperCfMemcached" hint="Initializes instance copies of MemcachedFactory and Memcached">
		<cfargument name="componentPath" type="string" required="true" />
		<cfargument name="servers" type="string" required="false" default="127.0.0.1:11211" />
		<cfargument name="defaultTimeout" type="string" required="false" default="61" />
		<cfargument name="defaultUnit" type="string" required="true" default="seconds" />
		
		<cfset this.MemcachedFactory = CreateObject("component","#arguments.componentPath#").init() />
		<cfset this.Memcached = this.MemcachedFactory.getMemcached() />
		
		<cfreturn this />
	</cffunction>
	
	
	<!--- get() --->
	<cffunction name="get" access="public" output="false" returntype="any" hint="get() method wrapper">
		<cfargument name="key" type="string" required="true" />
		<cfreturn this.Memcached.get(arguments.key) />	
	</cffunction>
	
	
	<!--- set() --->
	<cffunction name="set" access="public" output="false" returntype="boolean" hint="set() method wrapper">
		<cfargument name="key" type="string" required="true" />
		<cfargument name="value" type="any" required="true" />
		<cfargument name="expiry" type="numeric" required="true" />
		<cfset this.Memcached.set(arguments.key, arguments.value, arguments.expiry) />	
		<cfreturn true />	
	</cffunction>
	
	
	<!--- delete() --->
	<cffunction name="delete" access="public" output="false" returntype="boolean" hint="delete() method wrapper">
		<cfargument name="key" type="string" required="true" />
		<cfargument name="delay" type="numeric" required="false" default="0" />
		<cfset this.Memcached.delete(arguments.key, arguments.delay) />	
		<cfreturn true />	
	</cffunction>
	
	
	<!--- getStats() --->
	<cffunction name="getStats" access="public" output="false" returntype="any" hint="set() method wrapper">
		<cfreturn this.Memcached.getStats() />	
	</cffunction>
	
	
</cfcomponent>